@using MockSchoolManagement.Extensions
@model System.Collections.Generic.IEnumerable<MockSchoolManagement.Models.Student>

@{
    ViewBag.PageTitle = "学生列表";
}

<div class="card-deck">
    @foreach (var student in Model)
    {
        var photoPath = $"~/images/noimage.png";
        if (student.PhotoPath != null)
        {
            photoPath = $"~/images/avatars/{student.PhotoPath}";
        }
        <div class="card m-3">
            <div class="card-header">
                <h3 class="card-title">@student.Name</h3>
            </div>
            <img class="card-img-top img-thumbnail" src="@photoPath" alt="" asp-append-version="true"/>
            
            <div class="card-body">
                <h5 class="card-title">主修科目：@student.Major.GetDisplayName()</h5>
            </div>
            
            <div class="card-footer text-center">
                <a asp-controller="Home" asp-action="Details" asp-route-id="@student.Id" class="btn btn-primary m-1">查看</a>
                <a asp-controller="Home" asp-action="Edit" asp-route-id="@student.Id" class="btn btn-primary m-1">编辑</a>
                <a href="#" class="btn btn-primary m-1">删除</a>
            </div>

        </div>
    }
</div>


    